#!/bin/sh
#desc:Output to the standard logfile
#package:odevents
#type:local

# Copyright(c) 2011 OpenDomo Services SL. Licensed under GPL v3 or later

LOGFILE="/var/log/events.log"
tstamp=`date +%H:%M:%S`
LEVEL="$1"
MODULE="$2"
TEXT="$3"

if ! test -f "$LOGFILE"; then
	# After bootstart it should call this script as a Root
	if test `whoami` == "root"; then
		touch $LOGFILE
		chown admin:admin $LOGFILE
		chmod 0622 $LOGFILE	
	fi
fi
echo "$tstamp	$MODULE.$LEVEL	$TEXT" >> $LOGFILE

